VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Derived"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'***************************************************************
' (c) Copyright 2000 Matthew J. Curland
'
' This file is from the CD-ROM accompanying the book:
' Advanced Visual Basic 6: Power Techniques for Everyday Programs
'   Author: Matthew Curland
'   Published by: Addison-Wesley, July 2000
'   ISBN: 0-201-70712-8
'   http://www.PowerVB.com
'***************************************************************
Option Explicit

'Type for stack alloc
Private Type InitData
    AggData(0) As AggregateData
    IIDs(0) As VBGUID
End Type

Private m_Hook As UnknownHook
Private m_DerivedOverride As DerivedOverride

Public Function OverrideMe() As String
    OverrideMe = "Derived Original"
End Function
Friend Function Derived_OverrideMe() As String
    Derived_OverrideMe = "Derived Redirect, " & OverrideMe
End Function

Private Sub Class_Initialize()
Dim InitData As InitData
Dim LastIID As LastIID
Dim TestThis As Derived
    
    'Get the IID for the base class.
    InitLastIID LastIID
    On Error Resume Next
    Set TestThis = LastIID.QIThis
    On Error GoTo 0
    
    With InitData
        With .AggData(0)
            .Flags = adUseIIDs Or adFullyResolved Or adBeforeHookedUnknown
            .FirstIID = 0
            Set .pObject = modDerived.InitOverride(m_DerivedOverride, Me)
        End With
        .IIDs(0) = LastIID.IID
        VBoost.AggregateUnknown Me, .AggData, .IIDs, m_Hook
    End With
End Sub
